package evance.user.war.controller.home;

import java.security.Principal;
import java.util.Locale;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import evance.server.common.service.ProductService;

@Controller
public class HomeController {
	private static Logger LOG = Logger.getLogger(HomeController.class);
	@Autowired
	private ProductService pizzaService;

	@ModelAttribute("page")
	public String module() {
		return "home/home";
	}

	@RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
	public String home(Locale locale, Model model, Principal principal) {
		LOG.debug("Welcome home ! the client locale is " + locale.toString() + "; " + locale.getDisplayName());
		return principal != null ? "home/signedIn" : "home/notSignedIn";// URLConstants.SIGNED_IN_URL:
																		// URLConstants.NOT_SIGNED_IN_URL;
	}

}